from fastapi import APIRouter, Depends

from forward.api.admin.schemas.merchant import MerchantAddInSchema, MerchantDeleteInSchema, MerchantDetailInSchema, MerchantEditInSchema, MerchantListInSchema
from forward.api.admin.service.merchant import MerchantService

merchant = APIRouter(prefix="/merchant")


@merchant.post("/lists")
async def list(list_in: MerchantListInSchema, merchant_service: MerchantService = Depends(MerchantService.instance)):
    return await merchant_service.lists(list_in)


@merchant.post("/add")
async def add(add_in: MerchantAddInSchema, merchant_service: MerchantService = Depends(MerchantService.instance)):
    return await merchant_service.add(add_in)


@merchant.post("/delete")
async def delete(delete_in: MerchantDeleteInSchema, merchant_service: MerchantService = Depends(MerchantService.instance)):
    return await merchant_service.delete(delete_in)


@merchant.post("/detail")
async def detail(detail_in: MerchantDetailInSchema, merchant_service: MerchantService = Depends(MerchantService.instance)):
    return await merchant_service.detail(detail_in)


@merchant.post("/edit")
async def edit(edit_in: MerchantEditInSchema, merchant_service: MerchantService = Depends(MerchantService.instance)):
    return await merchant_service.edit(edit_in)
